#ifndef VIRTUALMACHINE_H_INCLUDED
#define VIRTUALMACHINE_H_INCLUDED

#include "CodeGenerator.h"

#define TRUE 1
#define FALSE 0
#define MEMORYSIZE 32000
#define REGISTERSIZE 32

/*##############################################################################
#                                                                              #
# COMMANDS AND SPECIAL PURPOSE REGISTERS                                       #
#                                                                              #
##############################################################################*/
#define LINKREGISTER 31
#define STACKPOINTER 30
#define FRAMEPOINTER 29
#define GLOBALPOINTER 26


/*##############################################################################
#                                                                              #
# METHODS AND GLOBAL VARIABLES                                                 #
#                                                                              #
##############################################################################*/
int runVirtualMachine(int d, char *fileName);
void vm_usageError();
void vm_initialize();
int vm_readExecutableFileToMemory(char *fileName);
void vm_fetchInstruction();
int vm_decodeInstruction(char *op, char *a, char *b, int *c);
void vm_executeInstruction(char *op, char *a, char *b, int *c);
void vm_printStatus();
char *vm_getInstructionString(char op);
void vm_printStack();

int vm_run;
int vm_debug;
long *vm_reg;
unsigned long vm_instructionRegister;
unsigned char *vm_memory;
int vm_programCounter;
long vm_programSize;

unsigned long temp;

#endif // VIRTUALMACHINE_H_INCLUDED

